package org.aurora.model.entity;

import org.aurora.common.util.NetworkUtil;

import java.io.Serializable;

public class SlotAssignInfo implements Serializable {
    private Integer slot;

    private String schedulerIp;

    private Integer schedulerPort;

    private String schedulerAddr;

    public SlotAssignInfo(Integer slot, String schedulerIp, Integer schedulerPort) {
        this.slot = slot;
        this.schedulerIp = schedulerIp;
        this.schedulerPort = schedulerPort;
        this.schedulerAddr = NetworkUtil.splicingAddr(schedulerIp, schedulerPort);
    }

    public Integer getSlot() {
        return slot;
    }

    public void setSlot(Integer slot) {
        this.slot = slot;
    }

    public String getSchedulerIp() {
        return schedulerIp;
    }

    public void setSchedulerIp(String schedulerIp) {
        this.schedulerIp = schedulerIp;
    }

    public Integer getSchedulerPort() {
        return schedulerPort;
    }

    public void setSchedulerPort(Integer schedulerPort) {
        this.schedulerPort = schedulerPort;
    }

    public String getSchedulerAddr() {
        if (schedulerAddr == null) {
            schedulerAddr = NetworkUtil.splicingAddr(schedulerIp, schedulerPort);
        }
        return schedulerAddr;
    }
}
